package com.delong.util;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.zip.ZipException;

import net.erdfelt.android.apk.AndroidApk;

public class ReadApkUtil {

	public static Map<String, String> getApkMessage(String ApkFilePath) throws ZipException, IOException {
		Map<String, String> ApkMsg = new HashMap<String, String>();
		if (!ApkFilePath.equals("")) {
			File apkfile = new File(ApkFilePath);
//			System.out.println("test");
			if(!apkfile.exists())
			{
//				System.out.println("file not exists");
			}
			AndroidApk apk = new AndroidApk(apkfile);
			ApkMsg.put("packageName", apk.getPackageName());
			ApkMsg.put("appVersion", apk.getAppVersion());
			ApkMsg.put("appVersionCode", apk.getAppVersionCode());
			return ApkMsg;
		}
		return null;
	}
}
